<%@ page language="java"
         contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ page isELIgnored="false" %>
<!-- isELIgnored=true禁用EL表达式 -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!-- JSTL格式化标签 -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>管理员登陆页面</title>
    <script src="${pageContext.request.contextPath}/js/jquery.min-2.1.1.js"></script>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/layui-v2.6.13/layui/css/layui.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/layui-v2.6.13/layui/layui.js"></script>
    <style>
        .layui-btn-container{
            margin-top: 30px;
            margin-left: 50px;
        }
        #dd{
            margin-left: 100px;
        }
    </style>
</head>

<body>
<form class="layui-form" >
    <div class="layui-form-item">
        <label class="layui-form-label">请输入金额</label>
        <div class="layui-input-inline">
            <input type="text" id="money" name="uMoney" required  lay-verify="required" placeholder="请输入金额" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-btn-container">
            <button type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="mon(100)">￥100&nbsp;&nbsp;&nbsp;</button>
            <button type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="mon(500)">￥500&nbsp;&nbsp;&nbsp;</button>
            <button type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="mon(1000)">￥1000&nbsp;&nbsp;</button>
        </div>
        <div class="layui-btn-container">
            <button type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="mon(2000)">￥2000&nbsp;</button>
            <button type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="mon(5000)">￥5000&nbsp;</button>
            <button type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="mon(10000)">￥10000</button>
        </div>
    </div>
</form>
<button id="dd" type="button"style="width: 200px" class="layui-btn layui-btn-radius layui-btn-warm"
        onclick="sureRecharge()">充值</button>

</body>
<script>
    function mon(money){
        console.info(money);
        $("#money").attr("value",money)
    }
    function sureRecharge(){
        var params = $("form").serialize();
        // params += "&userId="+id;
        console.info(params);
        $.ajax({
            url:"${pageContext.request.contextPath}/user/rechargeMoney",
            type:"post",
            data:params,
            success:function (code){
                if(code === "1"){
                    alert("充值成功");
                } else {
                    alert("充值失败");
                }
                window.parent.location.reload();
            }
        });
    }
</script>
</html>
